In a magnetic recording channel, an error-correction code, such as a low-density parity-check (LDPC) code, is sometimes used together with a modulation code to improve the channel's performance characteristics. Two representative modulation codes that are often used in magnetic recording channels are a run-length-limited (RLL) code and a maximum-transition-run (MTR) code. An RLL code limits the number of consecutive zeros stored in a magnetic track to a specified maximum number, which can help the magnetic recording channel to reliably generate a clock signal using a phase-lock loop. An MTR code limits the number of consecutive ones in a magnetic track to a specified maximum number, which can help to alleviate the adverse effects of inter-symbol interference. However, one problem with a conventional magnetic recording channel is that parity bits of the error-correction code are not subjected to MTR or RLL coding, which causes the recorded data to sometimes have undesirable bit sequences despite the use of MTR or RLL coding on other parts of the codeword(s). The fact that a practical modulation codec for parity bits of a block error-correction code has not been sufficiently developed yet is at least partially responsible for this problem.